{include file='comdir/head.html'}
<body>
<div class="content">
	<div class="animated fadeInDown">
		<div class="pos"><a href="#" onClick="javascript :history.back(-1);">返回上一页</a></div>
		<form class="form-horizontal" action="javascript:void(0)" id='frm'>
			<div class="form-group">
				<label class="col-sm-2 control-label">网站名称</label>
				<div class="col-sm-5">
					<input type="text" class="form-control" name="sitename" value="">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">站长|单位</label>
				<div class="col-sm-5">
					<input type="text" class="form-control" name="webmaster" value="">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">分类</label>
				<div class="col-sm-5">
					<select class="form-control classid" name="classid">
						{foreach from=$linkclass item=vo}
						<option value="{$vo.classid}">{$vo.classname}</option>
						{/foreach}
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">类型</label>
				<div class="col-sm-5">
					<select class="form-control type" name="type">
						<option value="0">logo连接</option>
						<option value="1" selected>文字连接</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">URL</label>
				<div class="col-sm-5">
					<input type="text" class="form-control" name="url" value="">
				</div>
			</div>
			<div class='type_logo'  style="display:none">
			<div class="form-group img_show_hide"  style="display:none" >
				<label class="col-sm-2 control-label">LOGO</label>
				<div class="col-sm-10">
					<img class="show_linklogo" style="width:100px;height:30px;margin-bottom: 5px;" src="" /><br />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">LOGO</label>
				<div class="col-sm-10">
					<input type="hidden" value="" name="logo" class="linklogo">
					<div class="iframe-box btn-success"><iframe id="upiframe" frameborder="0"  scrolling="no" src="{$_URL}Ups/upone?method=linklogo&classname=linklogo&callback=linklogoback"></iframe></div>
				</div>
			</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">描述</label>
				<div class="col-sm-5" style="display: inline-block;vertical-align: middle;"><textarea class="form-control" name="description"></textarea></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">推荐</label>
				<div class="col-sm-5">
					<div class="radio radio-inline">
						<input type="radio" id="recommend1" name="recommend" value="1">
						<label for="recommend1">是</label>
					</div>
					<div class="radio radio-inline">
						<input type="radio" id="recommend2" checked name="recommend" value="0">
						<label for="recommend2">否</label>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">审核</label>
				<div class="col-sm-5">
					<div class="radio radio-inline">
						<input type="radio" id="verify1" checked name="verify" value="1">
						<label for="verify1">通过</label>
					</div>
					<div class="radio radio-inline">
						<input type="radio" id="verify2" name="verify" value="0">
						<label for="verify2">禁止</label>
					</div>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-5">
					<input type="button" class="btn btn-block btn-blue sub" name="name" value="提交">
				</div>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
var _URL='{$_URL}';
{literal}
function linklogoback(data){
	var classname=data.classname;
	$('.'+classname).val(data.img);
	$('.img_show_hide').show();
	$('.show_'+classname).attr('src',data.imgshow);
}
ajax_status=true;
$(function(){
	//类型选择
	$('.type').change(function(){
		var value=$(this).val();
		if(value==1){
			$('.type_logo').hide();
		}else{
			$('.type_logo').show();
		}
		
	})
	$('.sub').click(function(){
		var url=_URL+"Link/add";
		var formjquery=_ajaxs.from('#frm');
		if(ajax_status===false){return false;}
		ajax_status=false;
		_ajaxs.post(url,'formjquery='+formjquery,function _result(data){
			ajax_status=true;
			layer.msg(data.msg,{icon: 1}, function(){
				if(data.status){
					window.location.href=_URL+"Link/lists";
				}
			});
		});
	})
})
{/literal}
</script>
</body>
</html>
